CC=g++
CFLAGS=-g -c
DIR_INC=./include
DIR_SRC=./src
DIR_OBJ=./obj
DIR_BIN=./bin

SRCS=$(DIR_SRC)/kdtree.cc\
		 $(DIR_SRC)/FontFeatureExtractor.cc\
		 $(DIR_SRC)/MyFontFeatureExtractor.cc\
		 $(DIR_SRC)/HaarFontFeatureExtractor.cc\
		 $(DIR_SRC)/HogFontFeatureExtractor.cc\
		 $(DIR_SRC)/Similarity.cc\
		 $(DIR_SRC)/MySimilarity.cc\
		 $(DIR_SRC)/codecvt.cc


OBJS=$(patsubst %.cc, $(DIR_OBJ)/%.o, $(notdir $(SRCS)))
	
target:mkft query find mktbl

query:$(OBJS) $(DIR_OBJ)/query.o
	$(CC) $(OBJS) $(DIR_OBJ)/query.o -lfreetype -o $(DIR_BIN)/query 
	@echo "-----------------------Compile and Link Successfully-----------------------"
	
mkft:$(OBJS) $(DIR_OBJ)/mkft.o
	$(CC) $(OBJS) $(DIR_OBJ)/mkft.o -lfreetype -o $(DIR_BIN)/mkft
	@echo "-----------------------Compile and Link Successfully-----------------------"
  
find:$(OBJS) $(DIR_OBJ)/findsimilar.o
	$(CC) $(OBJS) $(DIR_OBJ)/findsimilar.o -lfreetype -o $(DIR_BIN)/findsimilar 
	@echo "-----------------------Compile and Link Successfully-----------------------"
	
mktbl:$(OBJS) $(DIR_OBJ)/mktbl.o
	$(CC) $(OBJS) $(DIR_OBJ)/mktbl.o -lfreetype -o $(DIR_BIN)/mktbl 
	@echo "-----------------------Compile and Link Successfully-----------------------"

$(DIR_OBJ)/query.o:$(DIR_SRC)/query.cc 
	$(CC) $(CFLAGS) $(DIR_SRC)/query.cc -I$(DIR_INC) -o $(DIR_OBJ)/query.o 

$(DIR_OBJ)/mkft.o:$(DIR_SRC)/mkft.cc 
	$(CC) $(CFLAGS) $(DIR_SRC)/mkft.cc -I$(DIR_INC) -o $(DIR_OBJ)/mkft.o 
	
$(DIR_OBJ)/findsimilar.o:$(DIR_SRC)/findsimilar.cc 
	$(CC) $(CFLAGS) $(DIR_SRC)/findsimilar.cc -I$(DIR_INC) -o $(DIR_OBJ)/findsimilar.o 

$(DIR_OBJ)/mktbl.o:$(DIR_SRC)/mktbl.cc 
	$(CC) $(CFLAGS) $(DIR_SRC)/mktbl.cc -I$(DIR_INC) -o $(DIR_OBJ)/mktbl.o 

$(DIR_OBJ)/kdtree.o:$(DIR_SRC)/kdtree.cc $(DIR_INC)/kdtree.h
	$(CC) $(CFLAGS) $(DIR_SRC)/kdtree.cc -I$(DIR_INC) -o $(DIR_OBJ)/kdtree.o 

$(DIR_OBJ)/FontFeatureExtractor.o:$(DIR_SRC)/FontFeatureExtractor.cc $(DIR_INC)/FontFeatureExtractor.h
	$(CC) $(CFLAGS) $(DIR_SRC)/FontFeatureExtractor.cc -I/usr/include/freetype2 -I$(DIR_INC) -o $(DIR_OBJ)/FontFeatureExtractor.o
	
$(DIR_OBJ)/MyFontFeatureExtractor.o:$(DIR_SRC)/MyFontFeatureExtractor.cc $(DIR_INC)/MyFontFeatureExtractor.h
	$(CC) $(CFLAGS) $(DIR_SRC)/MyFontFeatureExtractor.cc -I$(DIR_INC) -o $(DIR_OBJ)/MyFontFeatureExtractor.o

$(DIR_OBJ)/HaarFontFeatureExtractor.o:$(DIR_SRC)/HaarFontFeatureExtractor.cc $(DIR_INC)/HaarFontFeatureExtractor.h
	$(CC) $(CFLAGS) $(DIR_SRC)/HaarFontFeatureExtractor.cc -I$(DIR_INC) -o $(DIR_OBJ)/HaarFontFeatureExtractor.o
	
$(DIR_OBJ)/HogFontFeatureExtractor.o:$(DIR_SRC)/HogFontFeatureExtractor.cc $(DIR_INC)/HogFontFeatureExtractor.h
	$(CC) $(CFLAGS) $(DIR_SRC)/HogFontFeatureExtractor.cc -I$(DIR_INC) -o $(DIR_OBJ)/HogFontFeatureExtractor.o

$(DIR_OBJ)/Similarity.o:$(DIR_SRC)/Similarity.cc $(DIR_INC)/Similarity.h
	$(CC) $(CFLAGS) $(DIR_SRC)/Similarity.cc -I$(DIR_INC) -o $(DIR_OBJ)/Similarity.o

$(DIR_OBJ)/MySimilarity.o:$(DIR_SRC)/MySimilarity.cc $(DIR_INC)/MySimilarity.h
	$(CC) $(CFLAGS) $(DIR_SRC)/MySimilarity.cc -I$(DIR_INC) -o $(DIR_OBJ)/MySimilarity.o

$(DIR_OBJ)/codecvt.o:$(DIR_SRC)/codecvt.cc $(DIR_INC)/codecvt.h
	$(CC) $(CFLAGS) $(DIR_SRC)/codecvt.cc -I$(DIR_INC) -o $(DIR_OBJ)/codecvt.o

clean:
	rm $(DIR_OBJ)/*.o

